UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cOd7U2YwTVba021GMVE9wDBZT06+fGLD3ora1+pjU+4=' 
WHERE 
  key_id = '396e204d5e1d67eed9d26a3f0c94235f06c0d830e8388428d7298bb89121342b' 
  AND (
    token = 'cOd7U2YwTVba021GMVE9wDBZT06+fGLD3ora1+pjU+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026