UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AK8qX+eVqJUInWIHCXLnlqowrDLUIyG8TODvEdIHAw8=' 
WHERE 
  key_id = '1d6b708c63a6ab5284008a365f01ffc57f87681d74af80efceec396ba416e2e4' 
  AND (
    token = 'AK8qX+eVqJUInWIHCXLnlqowrDLUIyG8TODvEdIHAw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055