UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p2k83fzfq8LF1u9AgzaLTQd04FFxKojgMFMO+NfODUI=' 
WHERE 
  key_id = '52bef39fe0e623ae61ed104108824e893340cd4c729fac78b9074030fa529ba2' 
  AND (
    token = 'p2k83fzfq8LF1u9AgzaLTQd04FFxKojgMFMO+NfODUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031