UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6GAYHwGRkMzMiELbJ+Wtl9W5SaxRqnBC8TV2XPrjHZk=' 
WHERE 
  key_id = '36af76062c3bd68a17114525d0ed99e8a7d77086b696e1a15fe12bbf070f1217' 
  AND (
    token = '6GAYHwGRkMzMiELbJ+Wtl9W5SaxRqnBC8TV2XPrjHZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023