UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x1YVYVDBmQxvH4z9tnH8caJMj36+g72IKti8+FtjF1U=' 
WHERE 
  key_id = '403976ef251e084af7b57f87df8e7540343b541f7cfac04a4b436e123b2c7d50' 
  AND (
    token = 'x1YVYVDBmQxvH4z9tnH8caJMj36+g72IKti8+FtjF1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025