UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHXLfjHNMK1J8Xy5Pl8u6+rQBRAWiEGuoqv91l/gs6c=' 
WHERE 
  key_id = 'c51e3a8b718f7ff1ec6b55b12112783465abefa28f60d91dc053ebedc5ec012f' 
  AND (
    token = 'lHXLfjHNMK1J8Xy5Pl8u6+rQBRAWiEGuoqv91l/gs6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028