UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r4APtfb/lI8Zu5D4ogx5z6rMljy9CaO0QjXN3VAWHmQ=' 
WHERE 
  key_id = '369195163d78de7e2231101a2f9f983404fc0cf8abf461e5cefd75a5c00861c3' 
  AND (
    token = 'r4APtfb/lI8Zu5D4ogx5z6rMljy9CaO0QjXN3VAWHmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046