UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dwZO2rQBHFulJT01JKAxtbpfQ4IISVFRru3TbkYHl6Y=' 
WHERE 
  key_id = 'dd884a04afab120c801eacfb84642b4166e81b69ce5aaf1c0c6b67bf33524019' 
  AND (
    token = 'dwZO2rQBHFulJT01JKAxtbpfQ4IISVFRru3TbkYHl6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021