UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5hFa5Oxi/xa4TJjLTP3SgF0Aqk81Oun+83VnvmHQkNo=' 
WHERE 
  key_id = '9047c8d98f9a95c8c57e4dc009ebec9c20472044cb70e639e9a09011151193f5' 
  AND (
    token = '5hFa5Oxi/xa4TJjLTP3SgF0Aqk81Oun+83VnvmHQkNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039