UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jhejtk6T+n5xGzOb3X9/uxDgmIq1FeOfVVwEe4Y+4fo=' 
WHERE 
  key_id = '44315ea01380e4dc8df91e3739ee03ecee65d249526b8028587bf54de1127c6c' 
  AND (
    token = 'Jhejtk6T+n5xGzOb3X9/uxDgmIq1FeOfVVwEe4Y+4fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041