UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNr7FjbJW0RQfwvryC+e9P1r11uM/sNvgp5OokaNUoI=' 
WHERE 
  key_id = '570f74d765a1c2b6e43716cc57c7062550b592eeabd1eb4a946845e5b9104eda' 
  AND (
    token = 'XNr7FjbJW0RQfwvryC+e9P1r11uM/sNvgp5OokaNUoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031