UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kF/QPe7khHEShXrsJmj2Sk+6EyxxJUWM6Kf+9meh90Y=' 
WHERE 
  key_id = 'd8d1a688fbe7750d441cdf63c692e77ae220a171adce52db9b60c2fd8dfd245f' 
  AND (
    token = 'kF/QPe7khHEShXrsJmj2Sk+6EyxxJUWM6Kf+9meh90Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041