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

Query time 0.00046