UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6D5rWoAjJJjZQvE1S+xHTob4hFRweEKmTpJwgeI3EhA=' 
WHERE 
  key_id = 'fa0218dfe059a418e73952b026d9b4cb6cf29210260ba87ec1f323876a31846e' 
  AND (
    token = '6D5rWoAjJJjZQvE1S+xHTob4hFRweEKmTpJwgeI3EhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032