UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2Wv4kkKJNUX/7kBPs9RN5F2+nAllS4U/wTO286AG4o=' 
WHERE 
  key_id = 'd58525b35c6b2a169e6298d8d214fc01125f60e500782b1e53475ce5435e3bee' 
  AND (
    token = 'o2Wv4kkKJNUX/7kBPs9RN5F2+nAllS4U/wTO286AG4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034