UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDY9T8+6J+woCRPZ0Ee9WeTJX3/Q3qC534J2gd+FA5Q=' 
WHERE 
  key_id = 'b705817656827bcfa4a134982a9e377de96ec98166c3635bddbe0cc2afd79e70' 
  AND (
    token = 'XDY9T8+6J+woCRPZ0Ee9WeTJX3/Q3qC534J2gd+FA5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033