UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1HS+mJvYZzFGO5gStbOSHRz4QobtpoWgsNC0baQAnbY=' 
WHERE 
  key_id = '3384dc162475763eb6d296a9a409b8b0c5332439125cd7b8449f234a392be50c' 
  AND (
    token = '1HS+mJvYZzFGO5gStbOSHRz4QobtpoWgsNC0baQAnbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040