UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJQDHLJiJfzqjyIJoaWO1kk5ziLzEEaozVHuD6TdZ5o=' 
WHERE 
  key_id = '78f126a74d130004755594fdbcd95a816fd2a157785b405be48f46d4a0b17e04' 
  AND (
    token = 'YJQDHLJiJfzqjyIJoaWO1kk5ziLzEEaozVHuD6TdZ5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031