UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K+n7ypk1JuwvP6nFE8EF/f1GDRJMBQNCKl8Ux7T8QyY=' 
WHERE 
  key_id = 'dee3b7853fed033a521187126768e05a31bc1cb99977cae953791418cb958f6d' 
  AND (
    token = 'K+n7ypk1JuwvP6nFE8EF/f1GDRJMBQNCKl8Ux7T8QyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029