UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5P71nwYemY/x6rlXKCHqhyCFY+ZxlCInnPq3vX/owiw=' 
WHERE 
  key_id = '846ecf2c158d7e3ed93119f3458c3e8e611d83e1364a3d758a2fd9aa7b2dd048' 
  AND (
    token = '5P71nwYemY/x6rlXKCHqhyCFY+ZxlCInnPq3vX/owiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033