UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfQX13XyE0sToPrmt5Me2M6XjTkoIwormicl6rArHCQ=' 
WHERE 
  key_id = 'cda1f88d769a05bdf7956626e6246e29f3ff7c8efb7a283d04e159bf65bf52ec' 
  AND (
    token = 'CfQX13XyE0sToPrmt5Me2M6XjTkoIwormicl6rArHCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040