UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sflKV9QfIqg11QOUTxqshUxDnYve1WHgTdGz+Jy1RTE=' 
WHERE 
  key_id = 'fd0f592e9586c19f75a0e05858e39389fa94baa06d421377b90d285e23a0ebe5' 
  AND (
    token = 'sflKV9QfIqg11QOUTxqshUxDnYve1WHgTdGz+Jy1RTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028