UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vv+gtIQ9vtLRshnXK4xbnF0QYH+qNkW+PpZ8aVhupOA=' 
WHERE 
  key_id = '1b0f8f499558860a603cd52a04e92490191d72dda68778dcff18abffa281dc58' 
  AND (
    token = 'vv+gtIQ9vtLRshnXK4xbnF0QYH+qNkW+PpZ8aVhupOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028