UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XLuqQGjDcjwxzOK/8bKByskmqOEjDg171v+G762yRMI=' 
WHERE 
  key_id = '822b8cfa479b147dfa921e74f89f515b287f3f414f934cc5cdaae2028c147e53' 
  AND (
    token = 'XLuqQGjDcjwxzOK/8bKByskmqOEjDg171v+G762yRMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029