UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rIadIXCOIWTJ4hOxGTyKI+kKtjfiaIKzwQcxmKWwcU0=' 
WHERE 
  key_id = 'cd81a0c80614171d14a41be5de85208d4a31ce009d3013e8347cacfba4971237' 
  AND (
    token = 'rIadIXCOIWTJ4hOxGTyKI+kKtjfiaIKzwQcxmKWwcU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024