UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h4orpOjycmrK0zJpMAXeIBJKwTlK6joZwBytUqQZp/w=' 
WHERE 
  key_id = '5a1dc952a9e36e5c839199fb1c28538d89d52ec3e781480f0e1cf180b03e5a82' 
  AND (
    token = 'h4orpOjycmrK0zJpMAXeIBJKwTlK6joZwBytUqQZp/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025