UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7dBp4HziEQg+riJKYvxWAPpntvnpET6ARm6hPrAJYYU=' 
WHERE 
  key_id = '4bde65377150cd3acc99d94d74e94856795ffb7392235e869d2741f79777046a' 
  AND (
    token = '7dBp4HziEQg+riJKYvxWAPpntvnpET6ARm6hPrAJYYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036