UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y2KY5rorS0trqqUUVCJCQgDSdjbzXxxaG3afDQc/m5I=' 
WHERE 
  key_id = '22645a5a74b5f2e329b541026f30329eb79f5a6c282c4be513a7b4262fdb5f18' 
  AND (
    token = 'y2KY5rorS0trqqUUVCJCQgDSdjbzXxxaG3afDQc/m5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029