UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M9Axkxj31OWbGqo+nfwEBHybVJ1NDsvOKqUOv23vP4w=' 
WHERE 
  key_id = 'ff6c99752df0ea4c43ae7c00599b0384008ac46425465a520f1db0f259e11798' 
  AND (
    token = 'M9Axkxj31OWbGqo+nfwEBHybVJ1NDsvOKqUOv23vP4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024