UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '39b2piaexmagVEEXsw4oiECoxMvBIvqO6PiZZTA7x6g=' 
WHERE 
  key_id = '57f03c63651b5b660b6a718a4f5ff8991af8c071f0d142a244c273841677b15e' 
  AND (
    token = '39b2piaexmagVEEXsw4oiECoxMvBIvqO6PiZZTA7x6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039