UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kuN6k636xILnhtRrbqtL/M6C83s1/oJvnv37Z9Zx820=' 
WHERE 
  key_id = '229cfb4609afddb9adf99230e59beb9924c11aaee5e650493729f62991c455e3' 
  AND (
    token = 'kuN6k636xILnhtRrbqtL/M6C83s1/oJvnv37Z9Zx820=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036