UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1eaZHqqMjlbCXkfPVwA9GeiAP16AX6cQPFAthMXtCWM=' 
WHERE 
  key_id = 'b5342c6bd159aa73ef1e20f65da5a51cd67be1c5b6b9118c14456650ea8516c5' 
  AND (
    token = '1eaZHqqMjlbCXkfPVwA9GeiAP16AX6cQPFAthMXtCWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028