UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uf2jAjJiyyplLpY6jxGwnLC9EYx61UwkERHrkV3IieY=' 
WHERE 
  key_id = '2d9697c0e1a21d9d6931cc015d33ca46e183052fa7b1b11e7d8d75aa7bba947c' 
  AND (
    token = 'uf2jAjJiyyplLpY6jxGwnLC9EYx61UwkERHrkV3IieY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036