UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WTYvjtmeQxqlTnelgV1bGXsaxTIDfPOP+NQ8bbrm99E=' 
WHERE 
  key_id = '4a9f684b62e88b7765a79fa1783c8c0fd8906208910a61174f5ea14244ca19dd' 
  AND (
    token = 'WTYvjtmeQxqlTnelgV1bGXsaxTIDfPOP+NQ8bbrm99E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023