UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WVfbXkFj9FA4tLloM3/sVoC85DJhAGS2gBgsetkKhZs=' 
WHERE 
  key_id = '9676ec798e10ee408cc82bda9a588d033d99444d829511b6aee195080e9bad58' 
  AND (
    token = 'WVfbXkFj9FA4tLloM3/sVoC85DJhAGS2gBgsetkKhZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036